package com.yingxue.lesson.service.impl;

import com.github.pagehelper.PageHelper;
import com.yingxue.lesson.entity.SysProduct;
import com.yingxue.lesson.entity.SysUser;
import com.yingxue.lesson.mapper.SysProductMapper;
import com.yingxue.lesson.service.ProductService;
import com.yingxue.lesson.utils.PageUtil;
import com.yingxue.lesson.vo.req.product.ProductPageVO;
import com.yingxue.lesson.vo.resp.PageVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author lai
 * @version 1.0
 * @date 2021/5/20 9:49
 * @description
 */
@Service
public class ProductServiceImpl implements ProductService {


    @Autowired
    private SysProductMapper sysProductMapper;


    @Override
    public PageVO<SysProduct> getProductPage(ProductPageVO vo) {
        PageHelper.startPage(vo.getPageNum(),vo.getPageSize());
        List<SysProduct> sysProducts = sysProductMapper.selectAll(vo);
        return PageUtil.getPageVo(sysProducts);
    }


    @Override
    public int batchDeletedLog(List<String> productIds) {
        return sysProductMapper.batchDeletedLog(productIds);
    }
}
